function setCookie(key, val, n) {
  let oDate = new Date();
  if (n) {
    oDate.setDate(oDate.getDate() + n);
  }
  document.cookie = key + "=" + val + ";expires=" + oDate;
}

function getCookie(key) {
  let arr = document.cookie.split("; ");
  for (let i = 0; i < arr.length; i++) {
    let arr1 = arr[i].split("=");
    if (arr1[0] == key) {
      return arr1[1];
    }
  }
}

function removeCookie(key) {
  setCookie(key, 1, -1);
}